<script setup name="App">
import { storeToRefs } from 'pinia'
import useStore from './store'

// useStore() 调用后能得到所有模块
const { user, counter } = useStore()

const { name, age } = storeToRefs(user)

const { count, double } = storeToRefs(counter)
const { changeCount, changeCountAsync } = counter
</script>
<template>
  <div>user: {{ name }} ~~ {{ age }}</div>
  <div>count: {{ count }}</div>
  <div>double: {{ double }}</div>
  <button @click="changeCount(3)">increment</button>
  <button @click="changeCountAsync(4)">increment async</button>
</template>
